package com.inspur.jzsxxzx.service.catalog.impl;

import com.inspur.jzsxxzx.entity.catalog.DataCatalogColumn;
import com.inspur.jzsxxzx.mapper.catalog.DataCatalogColumnMapper;
import com.inspur.jzsxxzx.service.catalog.DataCatalogColumnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DataCatalogColumnServiceImpl implements DataCatalogColumnService {
    
    @Autowired
    private DataCatalogColumnMapper dataCatalogColumnMapper;
    
    @Override
    public int save(DataCatalogColumn record) {
        return dataCatalogColumnMapper.insert(record);
    }
    
    @Override
    public DataCatalogColumn findById(String columnId) {
        return dataCatalogColumnMapper.selectByPrimaryKey(columnId);
    }
    
    @Override
    public int update(DataCatalogColumn record) {
        return dataCatalogColumnMapper.updateByPrimaryKey(record);
    }
    
    @Override
    public int deleteById(String columnId) {
        return dataCatalogColumnMapper.deleteByPrimaryKey(columnId);
    }
    
    @Override
    public List<DataCatalogColumn> findByCataId(String cataId) {
        return dataCatalogColumnMapper.selectByCataId(cataId);
    }
    
    @Override
    public List<DataCatalogColumn> findAll() {
        return dataCatalogColumnMapper.selectAll();
    }
    
    @Override
    public List<DataCatalogColumn> findByCondition(DataCatalogColumn condition) {
        return dataCatalogColumnMapper.selectByCondition(condition);
    }
    
    @Override
    public List<DataCatalogColumn> findByPage(DataCatalogColumn condition, int pageNum, int pageSize) {
        int offset = (pageNum - 1) * pageSize;
        return dataCatalogColumnMapper.selectByPage(condition, offset, pageSize);
    }
    
    @Override
    public int countByCondition(DataCatalogColumn condition) {
        return dataCatalogColumnMapper.countByCondition(condition);
    }
    
    @Override
    public DataCatalogColumn findByCataIdAndNameCn(String cataId, String nameCn) {
        return dataCatalogColumnMapper.selectByCataIdAndNameCn(cataId, nameCn);
    }
}